<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta name="viewport" id="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no"/>
<link href="./css/reset.css" rel="stylesheet" type="text/css">
<link href="./css/indent-details.css" rel="stylesheet" type="text/css">
<script src="js/jquery-1.8.3.min.js" type="text/javascript"></script>
</head>
<body>
<div class="near-box">
    <a href="javascript:history.back()" class="jd-qrdd-topbox">订单详情</a>
    <div class="jd-qrdd-bigbox">
        <!--地址部分-->
        <div class="jd-qrdd-a1">
       
        </div>
        <!--商品部分-->
        <div class="zjzz-buylist-goods1">
            <div class="zjzz-buylist-gtime">
                <span class="zjzz-buylist-gtime1"><i class="indent-details-img2"></i>天祥瑞官方旗舰店</span>
                <!-- <span class="zjzz-buylist-gtime2">联系客服</span> -->
            </div>
         
        </div>
        <!--商品金额部分-->
        <div class="indent-details-box2">
            <span class="indent-details-text4">应付总额</span>
            <span id="Total" class="indent-details-text5" style="color: red;"></span>
        </div>
        <div class="indent-details-box2">
            <span class="indent-details-text4 tcolor-grey">商品总价</span>
            <span id="Total2" class="indent-details-text5 tcolor-black">￥0.00</span>
        </div>
        <!-- <div class="indent-details-box2">
            <span class="indent-details-text4 tcolor-grey">运费</span>
            <span class="indent-details-text5 tcolor-black">￥0.00</span>
        </div> -->
        <!-- <div class="indent-details-box2">
            <span class="indent-details-text4 tcolor-grey">税费</span>
            <span class="indent-details-text5 tcolor-black">￥0.00</span>
        </div> -->
        <!-- <div class="indent-details-box2">
            <span class="indent-details-text4 tcolor-grey">发票信息</span>
            <span class="indent-details-text5 tcolor-black">不需要发票</span>
        </div> -->
        <!--订单编号部分-->
    </div>
     <!-- 支付方式选择 -->
	<div class="payType1"> 
		<img alt="" src="./images/wx.png">
	</div>
	<div class="payType2">
		<a onclick="aliPay()" id="getUrl"><img src="./images/zfb.png"></a>
	</div>
		<div onclick="javascript:location.href='offlinePurchase.jsp?cid=<%=request.getParameter("cid")%>'" class="payType3">
		线下支付
	</div>
</div>
<input id="cid" type="hidden" value="<%=request.getParameter("cid")%>">
</body>
<script type="text/javascript">
var path="<%=request.getSession().getAttribute("path")%>";
	$(function(){
		$.post("../../../tszs/txr/addressShop.do",function(data){
			
        	if(data.type==1){
        		var html=" <a href=\"./receiving-adress-list.jsp\" >"+
            	"<span class=\"qrdd-a1-t1\">"+data.data[0].uName+"</span>"+
            	"<span class=\"qrdd-a1-t1\">"+data.data[0].uPhone+"</span>"+
            	"<span class=\"qrdd-a1-t2\">默认</span>"+
            	"<div class=\"qrdd-a1-b1\">"+
            		"<span class=\"qrdd-a1-img1\"></span>"+
            		"<span class=\"qrdd-a1-t3\">"+data.data[0].uAddress+"</span>"+
            		"<input type='hidden' id='defaultAddress' value='"+data.data[0].uId+"'>"+
            	"</div>"+
            	"<span class=\"qrdd-a1-img2\"></span>"+
            	"</a>";
            	$(".jd-qrdd-a1").html(html);
        	}else{
        		$(".jd-qrdd-a1").html("<a href=\"./receiving-adress.jsp\" >添加收货地址</a>");
        	}
		},"json")
		var pid=$("#cid").val();
		$.post("../../../tszs/txr/confirmationOfOrder.do?pid="+pid,function(data){
			var html="";
			$("#Total").html("￥"+data.data[0].Total);
			$("#Total2").html("￥"+data.data[0].Total);
			for (var i = 0; i < data.data[0].datas.length; i++) {
				html+="<div class=\"zjzz-buylist-det\">"+
                "<img src='/file/"+data.data[0].datas[i].begin+"'>"+
                "<div class=\"zjzz-buylist-gdetail\">"+
                   "<span class=\"zjzz-buylist-gtit1\">"+data.data[0].datas[i].end+"<br>"+data.data[0].datas[i].tradeno+"</span>"+
                   " <span class=\"zjzz-buylist-gmoney\">"+	 
                        "<i class=\"zjzz-buylist-gm1\">￥"+data.data[0].datas[i].uName+"</i>"+
                        "<i class=\"zjzz-buylist-gm2\">x"+data.data[0].datas[i].productNum+"</i>"+
                    "</span>"+
                "</div>"+
            "</div>";
			}
        	$(".zjzz-buylist-goods1").append(html);
		},"json")
	})
</script>
<!-- 支付宝支付开始 -->
<script type="text/javascript">
	
	updateDefault();
	
	function aliPay(){
		location.href="../AliPay.jsp?id="+$("#cid").val();		
	}
	
	function updateDefault(){
		//修改默认收货地址
		$.post("../../../tszs/txr/updateDefault.do",{
			cId:$("#cid").val(),
			address:$("#defaultAddress").val()
		},function(res){
			
		})
		
	}
	
</script>
<!-- 支付宝支付结束 -->
</html>